//Std
#include <iostream>

//Qt
#include <QVector>

//Graphic
#include <GraphicEngine.h>
#include <GraphicPhysicBridge.h>

//Physics
#include <Simulation.h>
#include <Individual.h>

//Model
#include <Graph.h>

int main(void)
{
	std::cout << "Initializing Model Engine..." << std::endl;

	Graph         random_graph = Graph::genererGraphAleatoire(6, 15);
	Noeud&        root_node    = *random_graph.noeuds().at(0);
	QList<Arete*> aretes       = random_graph.aretes();

	QList<Arete*> vector_aretes = random_graph.voisinageAretes( root_node );

	std::cout << root_node << std::endl;

	for(auto it = aretes.begin(); it != aretes.end(); ++it)
	{
		Arete& arete = **it;
		std::cout << arete;
	}

	std::cout << "Sommet 1: " << root_node.map[Noeud::A] << std::endl;
	std::cout << "Sommet 2: " << root_node.map[Noeud::B] << std::endl;
	std::cout << "Sommet 3: " << root_node.map[Noeud::C] << std::endl;
	std::cout << "Sommet 4: " << root_node.map[Noeud::D] << std::endl;
	std::cout << "Sommet 5: " << root_node.map[Noeud::E] << std::endl;
	std::cout << "Sommet 6: " << root_node.map[Noeud::F] << std::endl;
	std::cout << "Sommet 7: " << root_node.map[Noeud::G] << std::endl;
	std::cout << "Sommet 8: " << root_node.map[Noeud::H] << std::endl;

	std::cout << "Initializing physic engine..." << std::endl;

	SimulationWorld world;

	std::cout << "Initializing Irrlicht..." << std::endl;

	GraphicEngine engine;
	BridgeFactory factory(engine);

	std::cout << "Generating individuals..." << std::endl;

	Individual individual_1 = Individual::fromGraph(random_graph, &factory);

	world.add( &individual_1 );

	std::cout << "Launching simulation..." << std::endl;

	while(true)
	{
		engine.RenderOnce();
	}

	return 0;
}